home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / List.pag < prev    next >
Text File  |  1997-06-14  |  4KB  |  141 lines

  1. VERSION 5.00
  2. Begin VB.PropertyPage List 
  3.    Caption         =   "List"
  4.    ClientHeight    =   3495
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   5925
  8.    PaletteMode     =   0  'Halftone
  9.    ScaleHeight     =   3495
  10.    ScaleWidth      =   5925
  11.    Begin VB.TextBox txtList 
  12.       Height          =   285
  13.       Left            =   240
  14.       TabIndex        =   2
  15.       Top             =   480
  16.       Width           =   2055
  17.    End
  18.    Begin VB.TextBox txtItemData 
  19.       Height          =   285
  20.       Left            =   2280
  21.       TabIndex        =   3
  22.       Top             =   480
  23.       Width           =   1215
  24.    End
  25.    Begin VB.ListBox lstItemData 
  26.       Height          =   2400
  27.       ItemData        =   "List.pgx":0000
  28.       Left            =   2280
  29.       List            =   "List.pgx":0002
  30.       TabIndex        =   1
  31.       TabStop         =   0   'False
  32.       Top             =   840
  33.       Width           =   1215
  34.    End
  35.    Begin VB.ListBox lstList 
  36.       Height          =   2400
  37.       ItemData        =   "List.pgx":0004
  38.       Left            =   240
  39.       List            =   "List.pgx":0006
  40.       TabIndex        =   0
  41.       TabStop         =   0   'False
  42.       Top             =   840
  43.       Width           =   2055
  44.    End
  45.    Begin VB.CommandButton cmdRemove 
  46.       Caption         =   "Remove"
  47.       Height          =   375
  48.       Left            =   4080
  49.       TabIndex        =   5
  50.       Top             =   1200
  51.       Width           =   1215
  52.    End
  53.    Begin VB.CommandButton cmdAdd 
  54.       Caption         =   "Add"
  55.       Height          =   375
  56.       Left            =   4080
  57.       TabIndex        =   4
  58.       Top             =   600
  59.       Width           =   1215
  60.    End
  61.    Begin VB.Label lbl 
  62.       Caption         =   "List"
  63.       Height          =   255
  64.       Index           =   0
  65.       Left            =   240
  66.       TabIndex        =   7
  67.       Top             =   240
  68.       Width           =   2055
  69.    End
  70.    Begin VB.Label lbl 
  71.       Caption         =   "Item Data"
  72.       Height          =   255
  73.       Index           =   1
  74.       Left            =   2280
  75.       TabIndex        =   6
  76.       Top             =   240
  77.       Width           =   1215
  78.    End
  79. End
  80. Attribute VB_Name = "List"
  81. Attribute VB_GlobalNameSpace = False
  82. Attribute VB_Creatable = True
  83. Attribute VB_PredeclaredId = False
  84. Attribute VB_Exposed = True
  85. Private Sub cmdAdd_Click()
  86.     If txtList <> sEmpty Then
  87.         lstList.AddItem txtList
  88.         lstItemData.AddItem Trim$(Val(txtItemData))
  89.         txtList = sEmpty
  90.         txtItemData = sEmpty
  91.         txtList.SetFocus
  92.         Changed = True
  93.     End If
  94. End Sub
  95.  
  96. Private Sub cmdRemove_Click()
  97.     If lstList.ListIndex <> -1 And lstItemData.ListIndex <> -1 Then
  98.         lstList.RemoveItem lstList.ListIndex
  99.         lstItemData.RemoveItem lstItemData.ListIndex
  100.         Changed = True
  101.     End If
  102. End Sub
  103.  
  104. Private Sub lstItemData_Click()
  105.     Static fInClick As Boolean
  106.     If fInClick Then Exit Sub
  107.     fInClick = True
  108.     lstList.ListIndex = lstItemData.ListIndex
  109.     fInClick = False
  110. End Sub
  111.  
  112. Private Sub lstList_Click()
  113.     Static fInClick As Boolean
  114.     If fInClick Then Exit Sub
  115.     fInClick = True
  116.     lstItemData.ListIndex = lstList.ListIndex
  117.     fInClick = False
  118. End Sub
  119.  
  120. Private Sub PropertyPage_ApplyChanges()
  121. With SelectedControls(0)
  122.     Dim i As Integer
  123.     .Clear
  124.     If lstList.ListCount Then
  125.         For i = 0 To lstList.ListCount - 1
  126.             .Add lstList.List(i), , CLng(lstItemData.List(i))
  127.         Next
  128.     End If
  129. End With
  130. End Sub
  131.  
  132. Private Sub PropertyPage_SelectionChanged()
  133. With SelectedControls(0)
  134.     Dim i As Integer
  135.     For i = 0 To .ListCount - 1
  136.         lstList.List(i) = .List(i)
  137.         lstItemData.List(i) = .ItemData(i)
  138.     Next
  139. End With
  140. End Sub
  141.